import { BasicColumn, FormSchema } from "/@/components/Table";

//列表数据
export const columns: BasicColumn[] = [
  {
    title: '签约商户',
    align: "center",
    dataIndex: 'businessId_dictText'
  },
  {
    title: '服务公司',
    align: "center",
    dataIndex: 'companyId_dictText'
  },
  {
    title: "任务名称",
    align: "center",
    dataIndex: "name"
  },
  {
    title: "结算单",
    align: "center",
    dataIndex: "settleDoc",
    slots: { customRender: 'fileSlot' },
  },
  {
    title: "总数据",
    align: "center",
    sorter: true,
    dataIndex: "totalAmount",
    slots: { customRender: 'totalSlot' },
  },
  {
    title: "成功数据",
    align: "center",
    dataIndex: "successAmount",
    slots: { customRender: 'successSlot' },
  },
  {
    title: "失败数据",
    align: "center",
    dataIndex: "failAmount",
    slots: { customRender: 'failSlot' },
  },
  {
    title: "服务费",
    align: "center",
    dataIndex: "serviceFee",
    slots: { customRender: 'serviceFeeSlot' },
  },
  {
    title: "状态",
    align: "center",
    dataIndex: "status",
    // filters: [
    //   { text: '待提交', value: '0' },
    //   { text: '待审核', value: '1' },
    //   { text: '已通过', value: '2' },
    //   { text: '已驳回', value: '3' },
    //   { text: '已作废', value: '4' },
    // ],
    // filterMultiple: false,
    slots: { customRender: 'statusSlot' },
  },
  {
    title: "发放状态",
    align: "center",
    dataIndex: "extendStatus",
    slots: { customRender: 'extendStatusSlot' },
  },
  {
    title: "创建时间",
    align: "center",
    sorter: true,
    dataIndex: "createTime"
  },
  {
    title: "提交时间",
    align: "center",
    sorter: true,
    dataIndex: "submitTime",
    customRender:({text}) =>{
      return !text ? "-" : text;
    },
  },
  {
    title: "审核时间",
    align: "center",
    sorter: true,
    dataIndex: "checkTime",
    customRender:({text}) =>{
      return !text ? "-" : text;
    },
  }
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "签约商户",
    field: 'businessId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "caishui_business,name,id,type=1 and is_default=0"
    },
    colProps: {span: 6},
  },
  {
    label: "服务公司",
    field: 'companyId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "caishui_middle_company,company_name,company_id",
    },
    colProps: {span: 6},
  },
  {
    label: "状态",
    field: "status",
    component: "JDictSelectTag",
    componentProps: {
      dictCode: "caishui_task_settle_status"
    },
    colProps: { span: 6 }
  },
  {
    label: "任务名称",
    field: "name",
    component: "JInput",
    colProps: { span: 6 }
  },
  {
    label: "发放状态",
    field: "extendStatus",
    component: "JDictSelectTag",
    componentProps: {
      dictCode: "caishui_extend_status"
    },
    colProps: { span: 6 }
  },
  {
    label: "总金额",
    field: "totalAmount",
    component: "JRangeNumber",
    colProps: { span: 8 }
  },
  {
    label: "总笔数",
    field: "totalNum",
    component: "JRangeNumber",
    colProps: { span: 8 }
  },
  {
    label: "创建时间",
    field: "createTime",
    component: "RangePicker",
    componentProps: {
      showTime: true
    },
    colProps: { span: 8 }
  },
  {
    label: "提交时间",
    field: "submitTime",
    component: "RangePicker",
    componentProps: {
      showTime: true
    },
    colProps: { span: 8 }
  },
  {
    label: "审核时间",
    field: "checkTime",
    component: "RangePicker",
    componentProps: {
      showTime: true
    },
    colProps: { span: 8 }
  }
];

//子表列表数据
export const caishuiTaskSettleItemColumns: BasicColumn[] = [
  {
    title: "编码",
    align: "center",
    dataIndex: "code",
    customRender:({text}) =>{
      return !text ? "-" : text;
    },
  },
  {
    title: "身份信息",
    align: "center",
    width: 240,
    dataIndex: "name",
    slots: { customRender: 'infoSlot' },
  },
  {
    title: "银行信息",
    align: "center",
    width: 240,
    dataIndex: "bankCard",
    slots: { customRender: 'bankSlot' },
  },
  {
    title: "下发金额(元)",
    align: "center",
    dataIndex: "money",
    customRender:({text}) =>{
      return !text ? "0.00" : text.toFixed(2);
    },
  },
  {
    title: "状态",
    align: "center",
    dataIndex: "status",
    filters: [
      { text: '待下发', value: '0' },
      { text: '待回馈', value: '1' },
      { text: '已完成', value: '2' },
      { text: '下发失败', value: '3' },
    ],
    filterMultiple: false,
    slots: { customRender: 'statusSlot' },
  },
  // {
  //   title: "下发时间",
  //   align: "center",
  //   dataIndex: "issuedTime",
  //   customRender:({text}) =>{
  //     return !text ? "-" : text;
  //   },
  // },
  {
    title: "银行反馈时间",
    align: "center",
    sorter: true,
    dataIndex: "bankFeedbackTime",
    customRender:({text}) =>{
      return !text ? "-" : text;
    },
  },
  {
    title: "银行反馈消息",
    align: "center",
    dataIndex: "bankFeedbackMessage",
    customRender:({text}) =>{
      return !text ? "-" : text;
    },
  },
  // {
  //   title: "电子回单",
  //   align: "center",
  //   fixed: 'right',
  //   dataIndex: "electronicReceipt",
  //   slots: { customRender: 'fileSlot' },
  // },
];

